package com.kd.xjoa.scheduled.search.bean;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;

public class IndexContent implements Serializable{

	private static final long serialVersionUID = 1L;

	private String id;
	
	private String url;
	
	private String domain;
	
	private Integer type;
	
	private String title;
	
	private String content;
	
	private Long date;
	
	private Integer source;
	
	private Integer entryId;
	
	private String author;
	
	private Integer authorId;
	
	private String keywordMeta;
	
	private Integer clickNum;
	
	private Integer commentNum;
	
	private Integer forwardNum;
	
	private Integer addressValue;
	
	private Integer posNeg;
	
	private Integer inforLeve;
	
	//--------------业务需求所加的属性 begin----------
	private boolean reportFlag = false;
	
	private boolean favorFlag = false;
	
	//是否已读，1：是，0：否
	private int isRead=0;
	
	private String sourceName="";
	
	//标签
	private String label;
	//--------------业务需求所加的属性 end----------
	
	private Long dateTime;

	public String getId() {
		return id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getSourceName() {
		return sourceName;
	}

	public void setSourceName(String sourceName) {
		this.sourceName = sourceName;
	}

	public boolean isReportFlag() {
		return reportFlag;
	}

	public void setReportFlag(boolean reportFlag) {
		this.reportFlag = reportFlag;
	}

	public boolean isFavorFlag() {
		return favorFlag;
	}

	public void setFavorFlag(boolean favorFlag) {
		this.favorFlag = favorFlag;
	}

	public int getIsRead() {
		return isRead;
	}

	public void setIsRead(int isRead) {
		this.isRead = isRead;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		if(StringUtils.isNotBlank(content)){
			content = content.replaceAll("\"","\\\\\"");  
		}
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getDate() {
		if(this.date == null){
			return null;
		}
		if(this.date > new Date().getTime()){
			this.date =  new Date().getTime() - 5*60*1000;
		}
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		return sdf.format(new Date(this.date));
	}
	
	public void setDateTime(Long dateTime) {
		this.dateTime = dateTime; 
	}
	
	public Long getDateTime(){
		return dateTime;
	}

	public void setDate(Long date) {
		this.date = date;
		setDateTime(date);
	}

	public Integer getSource() {
		return source;
	}

	public void setSource(Integer source) {
		this.source = source;
	}

	public Integer getEntryId() {
		return entryId;
	}

	public void setEntryId(Integer entryId) {
		this.entryId = entryId;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public Integer getAuthorId() {
		return authorId;
	}

	public void setAuthorId(Integer authorId) {
		this.authorId = authorId;
	}

	public String getKeywordMeta() {
		return keywordMeta;
	}

	public void setKeywordMeta(String keywordMeta) {
		this.keywordMeta = keywordMeta;
	}

	public Integer getClickNum() {
		return clickNum;
	}

	public void setClickNum(Integer clickNum) {
		this.clickNum = clickNum;
	}

	public Integer getCommentNum() {
		return commentNum;
	}

	public void setCommentNum(Integer commentNum) {
		this.commentNum = commentNum;
	}

	public Integer getForwardNum() {
		return forwardNum;
	}

	public void setForwardNum(Integer forwardNum) {
		this.forwardNum = forwardNum;
	}

	public Integer getAddressValue() {
		return addressValue;
	}

	public void setAddressValue(Integer addressValue) {
		this.addressValue = addressValue;
	}

	public Integer getPosNeg() {
		return posNeg;
	}

	public void setPosNeg(Integer posNeg) {
		this.posNeg = posNeg;
	}

	public Integer getInforLeve() {
		return inforLeve;
	}

	public void setInforLeve(Integer inforLeve) {
		this.inforLeve = inforLeve;
	}
	
}
